package com.jayson.demo.controller;

import com.jayson.mymvc.annotations.Autowired;
import com.jayson.mymvc.annotations.Controller;
import com.jayson.mymvc.annotations.RequestMapping;
import com.jayson.demo.service.DemoService;
import com.jayson.mymvc.annotations.Security;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Controller
@RequestMapping("/demo")
@Security(value = {"zhangsan", "lisi"})
public class DemoController {

    @Autowired
    private DemoService demoService;

    @RequestMapping("/test")
    @Security(value = {"wangwu"})
    public void test(HttpServletRequest req, String name, HttpServletResponse resp) throws IOException {
        resp.setHeader("Content-type", "text/html;charset=UTF-8");
        resp.getWriter().write("name:" + name);
        return ;
    }

    @RequestMapping("/index1")
    @Security(value = {"maliu"})
    public void index1(HttpServletResponse resp) throws IOException {
        resp.setHeader("Content-type", "text/html;charset=UTF-8");
        resp.getWriter().write("你已进入index1页面");
        return ;
    }


}
